C-extended fetch stage and instruction reader module#252
C-extended fetch stage and instruction reader module#252SiddharthShroff-dotcom wants to merge 18 commits into
Conversation
Implemented initial RVC fetch support with compressed instruction handling, decompression path integration, same-word buffering, and split instruction handling. Main aligned, compressed, branch-target, and split-at-PC-0x02 cases are passing locally. Stall/flush interaction and later split-boundary cases still need follow-up. Requires C decompressor module from Andrew.
🔧 DE1-SoC Synthesis Report Summary Diff
Comparing synthesis results from main branch vs. this PR |
|
|
||
| // TODO: probably can just get rid of those altogether | ||
| wire unused = &{ex_to_if.pc_old, ex_to_if.imm_ext}; | ||
| //assign imem__address = pc_cur; |
There was a problem hiding this comment.
for the changes in fetch here -- would you be able to move them into a fetch_compressed module (feel free to pick a different name) and conditionally instantiate it here similarly to how we do this for example with B extension decoder:
risc-v/src/modules/Instruction_Decode/Instruction_Decode.sv
Lines 141 to 154 in 2a95e8f
Probably also need to add C extension into makefile so that we have UTOSS_RISCV_ENABLE_C_EXT defined, but we can do that during integration
| , .reset(reset) | ||
| , .stall_f(stall_f) | ||
| , .flush_f(flush_f) | ||
| , .imem__address(imem__address) |
There was a problem hiding this comment.
We are probably going to get a "multiple drivers" error here, since this is being driven unconditionally during regular fetch operation
|
|
||
|
|
||
|
|
||
| `ifdef UTOSS_RISCV_ENABLE_C_EXT |
There was a problem hiding this comment.
Can you update both the top-level Makefile and the de1-soc's envs/de1-soc/quartus/scripts/synthesize.tcl script to make sure UTOSS_RISCV_ENABLE_C_EXT gets defined when we include "C" in the UTOSS_RISCV_CONFIG; you'll also need to update ci.yaml too to include "C" in the build matrix.
This is kinda loaded so lmk if you have any questions.
| assign instr_pc_o = | ||
| pc_i; |
There was a problem hiding this comment.
i think we can drop this passthrough
Implemented initial RVC fetch support in the fetch stage and instruction reader.
Main changes:
Added mixed 16-bit/32-bit instruction handling.
Added same-word buffering for compressed instructions.
Added split-instruction handling for 32-bit instructions crossing a 32-bit word boundary.
Integrated compressed instruction decompression before decode.
Updated fetch next-PC behavior to support PC+2 and PC+4 sequencing.
Locally tested passing cases include aligned 32-bit fetch, two compressed instructions in one word, compressed-to-split fetch, back-to-back split handling, branch targets to compressed/split instructions, and compressed PC+2 behavior.
Known follow-up work: stall/flush interaction and later split-boundary edge cases still need further testing/debugging.